import day from 'dayjs'

export function parseTime(value: number | string, format: string | undefined) {
  if (!format) {
    format = 'YYYY-MM-DD HH:mm:ss'
  }
  if (!value) {
    value = new Date().getTime()
  }
  if (value.toString().length < 13) {
    // @ts-ignore
    value = new Date().getTime() + value
  }
  return day(value).format(format)
}
